.class public Les/ae;
.super Ljava/lang/Object;
.source "EditGIFEncoder.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Les/ae$b;
    }
.end annotation


# instance fields
.field private final a:Lcom/esfile/screen/recorder/gif/encoder/a;

.field private b:Landroid/util/Pair;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/Pair<",
            "Ljava/lang/Long;",
            "Ljava/lang/Long;",
            ">;"
        }
    .end annotation
.end field

.field private c:Landroid/graphics/RectF;

.field private d:Les/f8;

.field private e:F

.field private f:I

.field private g:Lcom/esfile/screen/recorder/media/util/y;

.field private h:Ljava/util/concurrent/CountDownLatch;

.field private i:Ljava/lang/String;

.field private j:Ljava/lang/String;

.field private k:Les/n7;

.field private l:Les/ae$b;

.field private m:Ljava/util/concurrent/BlockingQueue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/BlockingQueue<",
            "Lcom/esfile/screen/recorder/media/util/l;",
            ">;"
        }
    .end annotation
.end field

.field private n:Les/zd;

.field private o:J

.field private final p:Ljava/util/concurrent/atomic/AtomicBoolean;

.field private q:Ljava/lang/String;


# direct methods
.method public constructor <init>(Lcom/esfile/screen/recorder/gif/encoder/a;)V
    .locals 2

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/high16 v0, 0x3f800000    # 1.0f

    .line 2
    iput v0, p0, Les/ae;->e:F

    const/16 v0, 0x19

    .line 3
    iput v0, p0, Les/ae;->f:I

    .line 4
    new-instance v0, Ljava/util/concurrent/LinkedBlockingDeque;

    const/16 v1, 0xa

    invoke-direct {v0, v1}, Ljava/util/concurrent/LinkedBlockingDeque;-><init>(I)V

    iput-object v0, p0, Les/ae;->m:Ljava/util/concurrent/BlockingQueue;

    .line 5
    new-instance v0, Ljava/util/concurrent/atomic/AtomicBoolean;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V

    iput-object v0, p0, Les/ae;->p:Ljava/util/concurrent/atomic/AtomicBoolean;

    .line 6
    iput-object p1, p0, Les/ae;->a:Lcom/esfile/screen/recorder/gif/encoder/a;

    return-void
.end method

.method static synthetic a(Les/ae;)Les/ae$b;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->l:Les/ae$b;

    return-object p0
.end method

.method private a(Landroid/view/Surface;)Z
    .locals 2

    .line 42
    iget-object v0, p0, Les/ae;->k:Les/n7;

    new-instance v1, Les/ae$a;

    invoke-direct {v1, p0}, Les/ae$a;-><init>(Les/ae;)V

    invoke-virtual {v0, v1}, Les/m7;->a(Les/m7$h;)V

    .line 43
    iget-object v0, p0, Les/ae;->k:Les/n7;

    invoke-virtual {v0, p1}, Les/n7;->a(Landroid/view/Surface;)V

    .line 44
    iget-object p1, p0, Les/ae;->k:Les/n7;

    invoke-virtual {p1}, Les/m7;->g()Z

    move-result p1

    return p1
.end method

.method static synthetic a(Les/ae;Landroid/view/Surface;)Z
    .locals 0

    .line 2
    invoke-direct {p0, p1}, Les/ae;->a(Landroid/view/Surface;)Z

    move-result p0

    return p0
.end method

.method static synthetic b(Les/ae;)Ljava/util/concurrent/atomic/AtomicBoolean;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->p:Ljava/util/concurrent/atomic/AtomicBoolean;

    return-object p0
.end method

.method static synthetic c(Les/ae;)Landroid/graphics/RectF;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->c:Landroid/graphics/RectF;

    return-object p0
.end method

.method static synthetic d(Les/ae;)Les/f8;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->d:Les/f8;

    return-object p0
.end method

.method static synthetic e(Les/ae;)I
    .locals 0

    .line 1
    iget p0, p0, Les/ae;->f:I

    return p0
.end method

.method static synthetic f(Les/ae;)Les/zd;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->n:Les/zd;

    return-object p0
.end method

.method static synthetic g(Les/ae;)Ljava/lang/String;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->q:Ljava/lang/String;

    return-object p0
.end method

.method static synthetic h(Les/ae;)Ljava/util/concurrent/CountDownLatch;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->h:Ljava/util/concurrent/CountDownLatch;

    return-object p0
.end method

.method static synthetic i(Les/ae;)J
    .locals 2

    .line 1
    iget-wide v0, p0, Les/ae;->o:J

    return-wide v0
.end method

.method static synthetic j(Les/ae;)Ljava/util/concurrent/BlockingQueue;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->m:Ljava/util/concurrent/BlockingQueue;

    return-object p0
.end method

.method static synthetic k(Les/ae;)Lcom/esfile/screen/recorder/media/util/y;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->g:Lcom/esfile/screen/recorder/media/util/y;

    return-object p0
.end method

.method static synthetic l(Les/ae;)Ljava/lang/String;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->j:Ljava/lang/String;

    return-object p0
.end method

.method static synthetic m(Les/ae;)Lcom/esfile/screen/recorder/gif/encoder/a;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->a:Lcom/esfile/screen/recorder/gif/encoder/a;

    return-object p0
.end method

.method static synthetic n(Les/ae;)Landroid/util/Pair;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->b:Landroid/util/Pair;

    return-object p0
.end method

.method static synthetic o(Les/ae;)Les/n7;
    .locals 0

    .line 1
    iget-object p0, p0, Les/ae;->k:Les/n7;

    return-object p0
.end method


# virtual methods
.method public a()V
    .locals 2

    const-string v0, "EditGIFEncoder"

    const-string v1, "request stop"

    .line 36
    invoke-static {v0, v1}, Lcom/esfile/screen/recorder/utils/n;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 37
    iget-object v0, p0, Les/ae;->p:Ljava/util/concurrent/atomic/AtomicBoolean;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V

    .line 38
    iget-object v0, p0, Les/ae;->p:Ljava/util/concurrent/atomic/AtomicBoolean;

    monitor-enter v0

    .line 39
    :try_start_0
    iget-object v1, p0, Les/ae;->l:Les/ae$b;

    if-eqz v1, :cond_0

    .line 40
    iget-object v1, p0, Les/ae;->l:Les/ae$b;

    invoke-virtual {v1}, Les/ae$b;->a()V

    .line 41
    :cond_0
    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1
.end method

.method public a(I)V
    .locals 0

    .line 4
    iput p1, p0, Les/ae;->f:I

    return-void
.end method

.method public a(Landroid/util/Pair;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/util/Pair<",
            "Ljava/lang/Long;",
            "Ljava/lang/Long;",
            ">;)V"
        }
    .end annotation

    .line 3
    iput-object p1, p0, Les/ae;->b:Landroid/util/Pair;

    return-void
.end method

.method public a(Lcom/esfile/screen/recorder/media/util/y;)V
    .locals 0

    .line 5
    iput-object p1, p0, Les/ae;->g:Lcom/esfile/screen/recorder/media/util/y;

    return-void
.end method

.method public a(Ljava/lang/String;Ljava/lang/String;Les/zd;)V
    .locals 9
    .param p2    # Ljava/lang/String;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    .line 6
    iget-object v0, p0, Les/ae;->j:Ljava/lang/String;

    if-eqz v0, :cond_0

    const-string v0, "could not call this method twice on a same instance."

    .line 7
    invoke-static {v0}, Lcom/esfile/screen/recorder/utils/n;->a(Ljava/lang/String;)V

    .line 8
    :cond_0
    iget-object v0, p0, Les/ae;->h:Ljava/util/concurrent/CountDownLatch;

    if-eqz v0, :cond_1

    const-string v0, "should not call this method twice on the same object"

    .line 9
    invoke-static {v0}, Lcom/esfile/screen/recorder/utils/n;->a(Ljava/lang/String;)V

    .line 10
    :cond_1
    iget-object v0, p0, Les/ae;->b:Landroid/util/Pair;

    const-wide/16 v1, 0x3e8

    if-nez v0, :cond_2

    .line 11
    new-instance v0, Landroid/util/Pair;

    const-wide/16 v3, 0x0

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v3

    invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v4

    invoke-direct {v0, v3, v4}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V

    iput-object v0, p0, Les/ae;->b:Landroid/util/Pair;

    const-string v0, "range is null ........"

    .line 12
    invoke-static {v0}, Lcom/esfile/screen/recorder/utils/n;->a(Ljava/lang/String;)V

    .line 13
    :cond_2
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "range = "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-object v3, p0, Les/ae;->b:Landroid/util/Pair;

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v3, "EditGIFEncoder"

    invoke-static {v3, v0}, Lcom/esfile/screen/recorder/utils/n;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 14
    iput-object p3, p0, Les/ae;->n:Les/zd;

    .line 15
    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-static {}, Les/qc$e;->c()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sget-object v0, Ljava/io/File;->separator:Ljava/lang/String;

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v3

    invoke-virtual {p3, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string v0, ".tmp"

    invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p3

    iput-object p3, p0, Les/ae;->j:Ljava/lang/String;

    .line 16
    iput-object p2, p0, Les/ae;->q:Ljava/lang/String;

    .line 17
    new-instance p2, Ljava/io/File;

    iget-object p3, p0, Les/ae;->j:Ljava/lang/String;

    invoke-direct {p2, p3}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 18
    invoke-virtual {p2}, Ljava/io/File;->exists()Z

    move-result p3

    if-eqz p3, :cond_3

    .line 19
    invoke-virtual {p2}, Ljava/io/File;->delete()Z

    .line 20
    :cond_3
    iput-object p1, p0, Les/ae;->i:Ljava/lang/String;

    .line 21
    new-instance p2, Les/n7;

    invoke-direct {p2}, Les/n7;-><init>()V

    iput-object p2, p0, Les/ae;->k:Les/n7;

    .line 22
    invoke-virtual {p2, p1}, Les/m7;->b(Ljava/lang/String;)Z

    .line 23
    iget-object v3, p0, Les/ae;->k:Les/n7;

    iget-object p1, p0, Les/ae;->b:Landroid/util/Pair;

    iget-object p1, p1, Landroid/util/Pair;->first:Ljava/lang/Object;

    check-cast p1, Ljava/lang/Long;

    invoke-virtual {p1}, Ljava/lang/Long;->longValue()J

    move-result-wide p1

    mul-long v4, p1, v1

    iget-object p1, p0, Les/ae;->b:Landroid/util/Pair;

    iget-object p1, p1, Landroid/util/Pair;->second:Ljava/lang/Object;

    check-cast p1, Ljava/lang/Long;

    invoke-virtual {p1}, Ljava/lang/Long;->longValue()J

    move-result-wide p1

    mul-long v6, p1, v1

    const/4 v8, 0x1

    invoke-virtual/range {v3 .. v8}, Les/m7;->a(JJZ)V

    .line 24
    iget-object p1, p0, Les/ae;->p:Ljava/util/concurrent/atomic/AtomicBoolean;

    monitor-enter p1

    .line 25
    :try_start_0
    new-instance p2, Les/ae$b;

    invoke-direct {p2, p0}, Les/ae$b;-><init>(Les/ae;)V

    iput-object p2, p0, Les/ae;->l:Les/ae$b;

    .line 26
    monitor-exit p1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 27
    new-instance p1, Ljava/util/concurrent/CountDownLatch;

    const/4 p2, 0x1

    invoke-direct {p1, p2}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    iput-object p1, p0, Les/ae;->h:Ljava/util/concurrent/CountDownLatch;

    const/16 p1, 0x3e8

    .line 28
    iget p2, p0, Les/ae;->f:I

    div-int/2addr p1, p2

    int-to-float p1, p1

    iget p2, p0, Les/ae;->e:F

    mul-float p1, p1, p2

    float-to-long p1, p1

    iput-wide p1, p0, Les/ae;->o:J

    .line 29
    new-instance p1, Ljava/lang/StringBuilder;

    invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V

    const-string p2, "sample delay:"

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    iget-wide p2, p0, Les/ae;->o:J

    invoke-virtual {p1, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    const-string p2, "EditGIFEncoder"

    invoke-static {p2, p1}, Lcom/esfile/screen/recorder/utils/n;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 30
    new-instance p1, Ljava/lang/Thread;

    iget-object p2, p0, Les/ae;->l:Les/ae$b;

    const-string p3, "gif encode thread"

    invoke-direct {p1, p2, p3}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V

    const/16 p2, 0xa

    .line 31
    invoke-virtual {p1, p2}, Ljava/lang/Thread;->setPriority(I)V

    .line 32
    invoke-virtual {p1}, Ljava/lang/Thread;->start()V

    .line 33
    :try_start_1
    iget-object p1, p0, Les/ae;->h:Ljava/util/concurrent/CountDownLatch;

    invoke-virtual {p1}, Ljava/util/concurrent/CountDownLatch;->await()V
    :try_end_1
    .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    .line 34
    invoke-virtual {p1}, Ljava/lang/InterruptedException;->printStackTrace()V

    :goto_0
    return-void

    :catchall_0
    move-exception p2

    .line 35
    :try_start_2
    monitor-exit p1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    throw p2
.end method
